package com.woniuxy.cloud.carl.store.app.apiImpl;

import com.woniu.cloud.Aspect.log.Log;
import com.woniuxy.cloud.carl.store.client.CommentClient;
import com.woniuxy.cloud.carl.store.client.param.*;
import com.woniuxy.cloud.carl.store.client.result.LitleCommentDto;
import com.woniuxy.cloud.carl.store.client.result.ServiceCommentDto;
import com.woniuxy.cloud.carl.store.client.result.SkuCommentDto;
import com.woniuxy.cloud.carl.store.service.CommentService;
import com.woniuxy.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CommentAPIImpl implements CommentClient {
    @Autowired
    CommentService commentService;
    @Override
    @Log("添加评论")
    public Result addComment(AddCommentParam param) {
        return commentService.addComment(param);
    }

    @Override
    @Log("用户删除评论")
    public Result delCommentByUser(Long userId, Long commentId) {
        return commentService.delComment(userId,commentId);
    }

    @Override
    @Log("管理员删除评论")
    public Result delCommentByAdmin(Long commentId) {
        return commentService.delCommentByAdmin(commentId);
    }

    @Override
    @Log("回复评论")
    public Result replyComment(ReplyCommentParam param) {
        return commentService.replyComment(param);
    }

    @Override
    @Log("查询商品评论")
    public Result<List<SkuCommentDto>> getSkuComment(GetSkuCommentParam param) {
        return commentService.getSkuComment(param);
    }

    @Override
    @Log("用户在sku或service页面内查询评论")
    public Result<List<LitleCommentDto>> getCommentInDetail(GetCommentInDetailParam param) {
        return commentService.getCommentInDetail(param);
    }

    @Override
    @Log("查询服务评论")
    public Result<List<ServiceCommentDto>> getServiceComment(GetServiceCommentParam param) {
        return commentService.getServiceComment(param);
    }


}
